//ES12: FinalizationRegistry
const finalRegistry = new FinalizationRegistry(() => {
  console.log("有对象被销毁");
})

let obj = {
  name: "yz"
}

finalRegistry.register(obj)

// 不定时回收
obj = null
